package org.dfg.corejava.designPattern.observer;

import java.util.HashSet;
import java.util.Set;

public class ConcreateSubject<E> implements Subject {

	private Set<Observer> os = new HashSet<Observer>();

	@Override
	public void notice() {
		for (Observer o : os) {
			o.eventHandler();
		}
	}

	@Override
	public void attach(Observer o) {
		os.add(o);
	}

	@Override
	public void detach(Observer o) {
		os.remove(o);
	}

}
